package org.goldenport.g3.sample

import org.goldenport.g3._
import org.goldenport.g3.adapters._
import org.goldenport.g3.messages._
import org.goldenport.g3.messages.entity._

/**
 * @since   Aug.  1, 2010
 * @version Aug. 29, 2010
 * @author  ASAMI, Tomoharu
 **/
case class MockEntityAdapter(anUri: String) extends EntityAdapter(new MockEntityDriver(anUri)) {
}

class MockEntityDriver(val uri: String) extends G3EntityDriver {
  def new_Agent(cmd: G3Command, ctx: G3AgentContext) = new MockEntityDriverAgent(uri, ctx)
}

class MockEntityDriverAgent(uri: String, context: G3AgentContext) extends G3EntityDriverAgent(uri, context) {

  def createTx(msg: CreateEntityClass): G3Event = {
    error("XXX")
  }

  def fetchTx(msg: FetchEntity): G3Event = {
    error("XXX")
  }

  def queryTx(msg: QueryEntity): G3Event = {
    error("XXX")
  }

  def queryTx(msg: QueryEntityExpression): G3Event = {
    error("XXX")
  }

  def insertTx(msg: InsertEntity): G3Event = {
    error("XXX")
    
  }
  
  def insertTx(msg: InsertEntitySet): G3Event = {
    error("XXX")
  }

  def updateTx(msg: UpdateEntity): G3Event = {
    error("XXX")
  }

  def updateTx(msg: UpdateEntitySet): G3Event = {
    error("XXX")
  }

  def deleteTx(msg: DeleteEntityId): G3Event = {
    error("XXX")
  }

  def deleteTx(msg: DeleteEntityExample): G3Event = {
    error("XXX")
  }

  def deleteTx(msg: DeleteEntityExpression): G3Event = {
    error("XXX")
  }

  def dropTx(msg: DropEntityClass): G3Event = {
    error("XXX")
  }
}
